/* 全局样式 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: #1e1e1e;
  color: #e8e8e8;
  height: 100vh;
  overflow: hidden;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 工具栏样式 */
.toolbar {
  height: 40px;
  background-color: #272727;
  border-bottom: 1px solid #3a3a3a;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 10px;
}

.toolbar-button {
  background: none;
  border: none;
  color: #e8e8e8;
  font-size: 14px;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.toolbar-button:hover {
  background-color: #3a3a3a;
}

/* 主容器 */
.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 侧边栏 */
.left-panel {
  width: 250px;
  border-right: 1px solid #3a3a3a;
  background-color: #2e2e2e;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.left-panel.hidden {
  transform: translateX(-100%);
  width: 0;
}

/* 侧边栏样式 */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #3a3a3a;
  background-color: #272727;
}

.sidebar-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
}

.sidebar-header .toolbar-button {
  padding: 4px 8px;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  background-color: #0366d6;
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.sidebar-header .toolbar-button:hover {
  background-color: #0256cc;
}

.sidebar-header .toolbar-button:active {
  background-color: #024ba0;
}

.file-explorer {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.file-item {
  padding: 8px 15px;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background-color 0.2s;
  font-size: 13px;
  border-left: 3px solid transparent;
}

.file-item:hover {
  background-color: #3a3a3a;
  border-left-color: #64b5f6;
}

.file-item.active {
  background-color: #0d47a1;
  border-left-color: #42a5f5;
}

/* 侧边栏组件样式 */
.sidebar {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 编辑区域 */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #1e1e1e;
}

.editor-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.markdown-input,
.preview-area {
  width: 50%;
  display: flex;
  flex-direction: column;
}

.markdown-input {
  border-right: 1px solid #3a3a3a;
  background-color: #2e2e2e;
}

.editor-header,
.preview-header {
  display: flex;
  align-items: center;
  padding: 8px 15px;
  background-color: #272727;
  border-bottom: 1px solid #3a3a3a;
  min-height: 37px;
}

.editor-title,
.preview-title {
  margin: 0;
  color: #e8e8e8;
  font-size: 14px;
  font-weight: normal;
}

.markdown-editor {
  flex: 1;
  border: none;
  padding: 15px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 14px;
  resize: none;
  background-color: #1e1e1e;
  color: #e8e8e8;
  outline: none;
  line-height: 1.5;
}

.markdown-editor::placeholder {
  color: #666;
}

.preview-content {
  flex: 1;
  padding: 20px;
  color: #e8e8e8;
  background-color: #1e1e1e;
  overflow-y: auto;
  line-height: 1.6;
}

/* 预览区域样式 */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
  color: #e8e8e8;
  margin: 1em 0 0.5em 0;
  font-weight: bold;
}

.preview-content p {
  margin: 0.5em 0;
}

.preview-content code {
  background-color: #2e2e2e;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.9em;
}

.preview-content pre {
  background-color: #2e2e2e;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  border-left: 3px solid #42a5f5;
}

.preview-content blockquote {
  border-left: 4px solid #42a5f5;
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background-color: #2e2e2e;
  color: #e8e8e8;
  font-style: italic;
}

.preview-content table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
  background-color: #2e2e2e;
}

.preview-content th,
.preview-content td {
  border: 1px solid #3a3a3a;
  padding: 8px 12px;
}

.preview-content th {
  background-color: #272727;
  font-weight: bold;
}

.preview-content ul,
.preview-content ol {
  margin: 0.5em 0;
  padding-left: 2em;
}

.preview-content li {
  margin: 0.25em 0;
}

.preview-content a {
  color: #42a5f5;
  text-decoration: none;
}

.preview-content a:hover {
  text-decoration: underline;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #2e2e2e;
}

::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .left-panel {
    position: absolute;
    z-index: 1000;
    height: 100%;
  }
  
  .left-panel.hidden {
    transform: translateX(-100%);
  }
  
  .editor-container {
    flex-direction: column;
  }
  
  .markdown-input,
  .preview-area {
    width: 100%;
    height: 50%;
  }
  
  .markdown-input {
    border-right: none;
    border-bottom: 1px solid #3a3a3a;
  }
}